<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="/Public/Admin/css/pintuer.css">
    <link rel="stylesheet" href="/Public/Admin/css/admin.css">
    <script src="/Public/Admin/js/jquery.js"></script>
    <script src="/Public/Admin/js/pintuer.js"></script>
</head>
<body>

<div class="panel admin-panel">
    <div class="body-content">
        <form class="form-x">
            <div class="form-group">
                <div class="label">
                    <label>可用余额：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" name="money" value="<?php echo ($data["money"]); ?>" readonly/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>提现金额：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="" name="txmoney" data-validate="required:提现金额"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>提款人姓名：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="" name="username" data-validate="required:提款人姓名"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>用户密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" value="" name="password"
                           data-validate="required:用户密码"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <input id="submit" type="button" value="提交" class="button bg-blue">
                    <input type="reset" value="重置" class="button bg-red">
                </div>
            </div>
        </form>
    </div>
</div>
<script src="/Public/layui/layui.all.js"></script>
<script>

    $("#submit").click(function () {

        var money = $("input[name='money']").val();

        var txmoney = $("input[name='txmoney']").val();

        var username = $("input[name='username']").val();

        var password = $("input[name='password']").val();


        if (txmoney == '' || txmoney == undefined) {
            alert('提现金额不能为空');
            return false;
        }
        if (parseFloat(txmoney) > parseFloat(money)) {
            alert('可提金额不足，请重新填写!!');
            return false;
        }

        if (username == '' || username == undefined) {
            alert('提款人不能为空');
            return false;
        }
        if (password == '' || password == undefined) {
            alert('密码不能为空');
            return false;
        }

        $.post("<?php echo U('Txorder/add')?>", {
            'txmoney': txmoney,
            'username': username,
            'password': password
        }, function (res) {
            alert(res.info);
            location.href = res.url;
        })
    });
</script>
</body>
</html>